#ifndef _ST7735S_H
#define _ST7735S_H
#include "spi.h"

// LCD 显示方向
#define DISPLAY_ROTATE_0                     (0) // 默认方向
#define DISPLAY_ROTATE_90                    (1) // 逆时针旋转90°
#define DISPLAY_ROTATE_180                   (2) // 逆时针旋转180°
#define DISPLAY_ROTATE_270                   (3) // 逆时针旋转270°  
/*************** LCD工作参数配置 ******************/
#define LCD_WIDE                            160
#define LCD_HIGH                            80
#define ST7735_XSTART                       0
#define ST7735_YSTART                       24
#define COLOR_INVERSION_EN                  (DISABLE)   // 显示颜色反转
#define LCD_DISPLAY_DIRECTION               (DISPLAY_ROTATE_0)
/************************************************** */
#if (LCD_DISPLAY_DIRECTION == DISPLAY_ROTATE_0) || (LCD_DISPLAY_DIRECTION == DISPLAY_ROTATE_180)
#define LCD_W                   LCD_WIDE
#define LCD_H                   LCD_HIGH
#else
#define LCD_W                   LCD_HIGH
#define LCD_H                   LCD_WIDE
#endif
// 颜色定义RGB565
// R R R R R G G G G G G B B B B B  
// 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  = WHITE
// 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  = BLACK
// 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0  = RED
#define COLOR_WHITE             (0xFFFF)
#define COLOR_BLACK             (0x0000)
#define COLOR_RED               (0xF800)
#define COLOR_GREEN             (0x07E0)
#define COLOR_BLUE              (0x001F)
#define COLOR_YELLOW            (0xFFE0)

void st7735s_lcd_init(void);
void st7735s_lcd_clear(uint16_t color);                                                                                        // 清屏
void st7735s_lcd_fill_color(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);                               // 矩形填充颜色
void st7735s_lcd_draw_point(uint16_t x, uint16_t y, uint16_t color);                                                           // 画点
void st7735s_lcd_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);                                // 绘制直线
void st7735s_lcd_draw_string(uint16_t x, uint16_t y, const uint8_t *p, uint16_t fc, uint16_t bc, uint8_t sizey, uint8_t mode); // 绘制字符串
void st7735s_lcd_draw_int(uint16_t x, uint16_t y, uint16_t num, uint8_t len, uint16_t fc, uint16_t bc, uint8_t sizey);         // 绘制整数变量
void st7735s_lcd_draw_float(uint16_t x, uint16_t y, float num, uint8_t len, uint16_t fc, uint16_t bc, uint8_t sizey);          // 绘制浮点数变量
void st7735s_lcd_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);                           // 绘制矩形
void st7735s_lcd_draw_circle(uint16_t x0, uint16_t y0, uint8_t r, uint16_t color);   
void lcd_burn_test(const uint32_t Delay);
#endif
